package com.smssalama.storage.framework;

import java.io.IOException;

import org.bouncycastle.crypto.CryptoException;

/**
 * Base class for storage encryptors (classes that encrypt/decrypt stored data)
 * 
 * @author Arnold P. Minde
 */
public abstract class StorageEncryptor {
	public abstract byte[] encrypt(byte[] data) throws IOException;

	public abstract byte[] decrypt(byte[] data) throws IOException,
			CryptoException;

	public static final StorageEncryptor NULL_ENCRYPTOR = new StorageEncryptor() {

		public byte[] decrypt(byte[] data) {
			return data;
		}

		public byte[] encrypt(byte[] data) {
			return data;
		}
	};
}
